package com.cositas.dulces.lp.action.impl;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.cositas.dulces.lp.ApplicationFacade;
import com.cositas.dulces.lp.action.Action;
import com.cositas.dulces.lp.model.ShoppingCart;
import com.google.appengine.api.datastore.EntityNotFoundException;

public class RemoveProductFromCartAction implements Action {

	public void doAction(HttpServletRequest req, HttpServletResponse resp) throws IOException, EntityNotFoundException, ServletException {

		String fbid = req.getParameter("fbid");
		String product = req.getParameter("product");
		ShoppingCart sc = ApplicationFacade.removeProduct(fbid, product);
		req.setAttribute("sc", sc);
		req.getRequestDispatcher("./" + req.getParameter("processedpage")).forward(req, resp);
	}
}
